package com.atguigu.sparkcore.rdd.file.sequence

import com.atguigu.sparkcore.util.MySparkContextUtil

/**
 * description ：将rdd保存为sequencefile文件
 * author ：剧情再美终是戏
 * mail : 13286520398@163.com
 * date ：Created in 2020/1/8 20:59
 * modified By ：
 * version: : 1.0
 */
object WSequenceFile {

  def main(args: Array[String]): Unit = {

    // 获取sparkContext
    val sc = MySparkContextUtil.get(args)

    // 创建rdd
    val rdd = sc.parallelize(Array(("a", 1), ("b", 2), ("c", 3), ("d", 4), ("e", 5)), 2)

    // 将rdd保存为sequencefile
    rdd.saveAsSequenceFile("c:/output")

      // 关闭sparkContext
      MySparkContextUtil.close(sc)
  }

}
